@echo off

set output=icq_srv.elf

set armdir=c:/arm
set sdkdir=../sdk
set lib_o=../Lib.o

if exist %output% del %output%


rem make oscar protocol...
set options=-DOSCAR_LOGGER

set src_oscar=oscar/oscar.c oscar/oscar_errors.c oscar/logger.c oscar/icq_packet.c oscar/chan_01login.c oscar/chan_02data.c oscar/chan_03error.c oscar/chan_04close.c oscar/chan_05ping.c
set oscar_o=oscar.o oscar_errors.o logger.o icq_packet.o chan_01login.o chan_02data.o chan_03error.o chan_04close.o chan_05ping.o

%armdir%/tcc -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% %src_oscar%

rem make app...

set options=-DDEBUG

set src_app=main.c mainmenu.c settings.c error.c connect.c
set src_util=util.c netapi.c cfgfile.c

%armdir%/tcc -I"%sdkdir%" -c -bigend -O2 -apcs /interwork %options% %src_app% %src_util%

set tmp_o=main.o mainmenu.o settings.o error.o netapi.o cfgfile.o util.o connect.o
set ext_o=../dbg/dbg.o ../libs/libc.o

echo =======================================

%armdir%/armlink -reloc -first Lib.o(Lib) -o %output% %tmp_o% %ext_o% %oscar_o% %lib_o%



del %oscar_o%
del %tmp_o%

if exist %output% (
	echo ACK: File `%output%` created
) else (
	echo ERR: File `%output%` not created
)
